<?php
        header("Content-type:text/html;charset=utf-8");
        $con = mysqli_connect("localhost", 'root', '', 'ksdb2');
        mysqli_set_charset($con, "utf8");
        
        
        $dpt_id = $_GET['dpt_id'];
        
        $mj_id  = $_GET['mj_id'];

        $mj_name  = $_GET['mj_name'];

        $sql = "INSERT INTO major (mj_id, mj_name, dpt_id) VALUES ('$mj_id','$mj_name','$dpt_id');";
        
        
        // 执行插入语句
        if($con->query($sql))
        {
            echo "添加成功";
        //删完回去表页面
        }
        else{
            echo "添加失败";
        }
        
        // 回到首页
        header("location:major.php");
        mysqli_close($con);
    ?>